package com.carlos.camunda.controller;

import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngines;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 李健成
 * @date 2021/11/23
 */

@RestController
@RequestMapping("/task")
public class TaskController {

    private final ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();

    @GetMapping("/start")
    public void start(String key) {
        processEngine.getRuntimeService().startProcessInstanceByKey(key);
    }

}
